//
//  HXMineViewController.m
//  Number To English
//
//  Created by 朱志雄 on 2024/7/23.
//

#import "HXMineView.h"
#define STATE_BAR_HEIGHT [UIApplication sharedApplication].statusBarFrame.size.height
#define FIT_WIDTH   [UIScreen mainScreen].bounds.size.width/375
#define FIT_HEIGHT  [UIScreen mainScreen].bounds.size.height/667
#define KScreen_W  [UIScreen mainScreen].bounds.size.width
#define KScreen_H  [UIScreen mainScreen].bounds.size.height

#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
#define ZXMainColor RGBACOLOR(209, 58, 42, 1)
#import "HXMineViewController.h"

#import "HXFeedbackViewController.h"
#import "HXinfoViewController.h"
#import "UINavigationController+FDFullscreenPopGesture.h"

@interface HXMineViewController ()

@end

@implementation HXMineViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = RGBACOLOR(215, 240, 230, 1);
    UIImageView *backView = [[UIImageView alloc] initWithFrame:self.view.bounds];
    backView.contentMode = UIViewContentModeScaleAspectFill;
    backView.image = [UIImage imageNamed:@"backimage"];
    [self.view addSubview:backView];
    
    [self loadNavView];
    [self loadBody];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBarHidden = YES;
}

-(void)loadNavView{
    UIView *navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreen_W, STATE_BAR_HEIGHT + 44)];
    navView.backgroundColor = RGBACOLOR(235, 230, 235, 1);
    [self.view addSubview:navView];
    
    
    UILabel *titleL = [[UILabel alloc] initWithFrame:CGRectMake(100, STATE_BAR_HEIGHT + 8, KScreen_W - 200, 25)];
    titleL.text = @"Setting";
    titleL.font = [UIFont boldSystemFontOfSize:20];
    titleL.numberOfLines = 0;
    titleL.textAlignment = NSTextAlignmentCenter;
    titleL.textColor = RGBACOLOR(22, 22, 22, 1);
    [navView addSubview:titleL];
}


-(void)loadBody{
    
    
    NSDictionary *dict_1 = @{@"image":@"info",@"title":@"info"};
    NSDictionary *dict_2 = @{@"image":@"Share",@"title":@"share"};
    NSDictionary *dict_3 = @{@"image":@"意见反馈",@"title":@"Feedback"};
    
    HXMineView *view_1 = [[HXMineView alloc] initWithFrame:CGRectMake(10, STATE_BAR_HEIGHT + 75, KScreen_W - 20, 50)];
    view_1.dict = dict_1;
    view_1.backgroundColor = [UIColor whiteColor];
    view_1.layer.cornerRadius = 5;
    view_1.layer.masksToBounds = YES;
    [self.view addSubview:view_1];
    
    
    HXMineView *view_2 = [[HXMineView alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(view_1.frame) + 16, KScreen_W - 20, 50)];
    view_2.dict = dict_2;
    view_2.backgroundColor = [UIColor whiteColor];
    view_2.layer.cornerRadius = 5;
    view_2.layer.masksToBounds = YES;
    [self.view addSubview:view_2];
    
    
    HXMineView *view_3 = [[HXMineView alloc] initWithFrame:CGRectMake(10,CGRectGetMaxY(view_2.frame) + 16, KScreen_W - 20, 50)];
    view_3.dict = dict_3;
    view_3.backgroundColor = [UIColor whiteColor];
    view_3.layer.cornerRadius = 5;
    view_3.layer.masksToBounds = YES;
    [self.view addSubview:view_3];
    
    
    UITapGestureRecognizer *SSSS_1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tpClick_1)];
    
    UITapGestureRecognizer *SSSS_2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tpClick_2)];
    
    UITapGestureRecognizer *SSSS_3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tpClick_3)];
    
    [view_1 addGestureRecognizer:SSSS_1];
    [view_2 addGestureRecognizer:SSSS_2];
    [view_3 addGestureRecognizer:SSSS_3];
    
//    UILabel *titleLs = [[UILabel alloc] initWithFrame:CGRectMake(100, KScreen_H - 118 , KScreen_W - 200, 20)];
//    titleLs.text = @"Version 1.0";
//    titleLs.font = [UIFont fontWithName:@"PingFangSC-Regular" size:14];
//    titleLs.numberOfLines = 0;
//    titleLs.textAlignment = NSTextAlignmentCenter;
//    titleLs.textColor = RGBACOLOR(22, 22, 22, 1);
//    [self.view addSubview:titleLs];
}

-(void)tpClick_1{
    
    HXinfoViewController *vc = [[HXinfoViewController alloc] init];
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
}

-(void)tpClick_2{
    NSString *str = @"Number To English";
    UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:@[str] applicationActivities:nil];
    [self presentViewController:activityVC animated:YES completion:nil];
    
}

-(void)tpClick_3{
    
    HXFeedbackViewController *vc = [[HXFeedbackViewController alloc] init];
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
}

@end
